//
//  BRConfigs.h
//  BrezzeSaaS
//
//  Created by IOS on 2021/8/31.
//  Copyright © 2021 Brezze GWG. All rights reserved.
//

#ifndef BRConfigs_h
#define BRConfigs_h
/*
 *  用于登录区分OTP计时
 */
static NSString *BRLoginByPhone = @"BRLoginByPhone";
static NSString *BRLoginByEmail =  @"BRLoginByEmail";

typedef void(^BRVoidBlock)(void);
typedef void(^BRIDBlock)(id);
typedef void(^BRIntBlock)(NSInteger);
typedef void(^BRStringBlock)(NSString *);
typedef void(^BRBOOLBlock)(BOOL);
typedef void(^BRDicBlock)(NSDictionary *);
typedef void(^BRStringIntBlock)(NSString *,NSInteger);

#define kTimeFormatter @"dd MMM, yyyy HH:mm:ss"
#define kTimeDMYFormatter @"dd MMM, yyyy"
#define kTimeFormatterCH @"yyyy-MM-dd HH:mm:ss"
/*
 * 日志输出
 */
#ifdef DEBUG //开发阶段
#define NSLog(format,...) printf("\n[----][--%s:%d行--]:\n%s\n",[[[NSString stringWithUTF8String:__FILE__] lastPathComponent] UTF8String],__LINE__,[[NSString stringWithFormat:(format), ##__VA_ARGS__] UTF8String]);
#else //发布阶段
#define NSLog(...) ;
#endif

#define kPageSize 20
#define kPromoCodeMax 8

#define USERManager [BRUserManager share]
#define BRImage(name) [UIImage imageNamed:name]

/// 国家码 默认
#define kAddCountryCode @"+84"
#define kCountryCode @"84"

/*
 * 屏幕宽高
 */
#define kScreenBounds  [[UIScreen mainScreen] bounds]
#define kScreenSize  [[UIScreen mainScreen] bounds].size
#define kScreenWidth  [[UIScreen mainScreen] bounds].size.width
#define kScreenHeight  [[UIScreen mainScreen] bounds].size.height
#define KStatusBarHeight  [BRTools currStatusBarHeight]
#define kStatusRect [[UIApplication sharedApplication] statusBarFrame]

#define kSafeAreaTopHeight (([BRTools isIPhoneX]) ? (KStatusBarHeight + 52) : 72)
#define kSafeAreaBottomHeight (([BRTools isIPhoneX]) ? 34 : 0)
#define kNavH (52)
/// 比例375为准
#define kScale(s) (kScreenWidth / 375.0 * s)

#define kScale414(s) (kScreenWidth / 414.0 * s)

/*
 * 偏好设置存储
 */
#define USER_DEFAULT [NSUserDefaults standardUserDefaults]

/*
 * 系统版本
 */
#define kSysVer ([UIDevice currentDevice].systemVersion.floatValue)

//弱引用
#define BRWS(s)  __weak typeof(s) s##Weak = self;
#define BRStrong(s)     __strong typeof(s) s = s##Weak;

#define BRWeakObj(o)    __weak typeof(o) o##Weak = o;
#define BRStrongObj(o)  __strong typeof(o) o = o##Weak;

#define WS(weakSelf)  __weak typeof(self) weakSelf = self;

/*
 * 默认配置色
 */

#define kColorMain UIColorMakeWithHex(@"#000000")

#define kUIColorMainTint  UIColorMakeWithHex(@"#E7FF55")
#define kColorMainAlpha(s) UIColorMakeWithRGBA(231, 255, 85, s)

#define kColorMainBorder UIColorMakeWithHex(@"#CCABE2")
#define kColorBGFF UIColorMakeWithHex(@"#FFFFFF")
#define kColorBGEE UIColorMakeWithHex(@"#EEEEF5")
#define kColorBGEB UIColorMakeWithHex(@"#EBEBEE")
#define kColorBGF0 UIColorMakeWithHex(@"#F0F0F2")
#define kColorBGF4 UIColorMakeWithHex(@"#F4F4F6")
#define kColorBGF5 UIColorMakeWithHex(@"#F5F5F7")
#define kColorBGEC UIColorMakeWithHex(@"#ECECEE")
#define kColorD2D8E2 UIColorMakeWithHex(@"#D2D8E2")
#define kColorTitle UIColorMakeWithHex(@"#39404D")
#define kColorTitleWhite UIColorMakeWithHex(@"#FFFFFF")
#define kColorTitle38393a UIColorMakeWithHex(@"#38393A")
#define kColorGreen76 UIColorMakeWithHex(@"#76D672")
#define kColorTitle999 UIColorMakeWithHex(@"#999999")
#define kColorTitle99B UIColorMakeWithHex(@"#99999B")
#define kColorTitle888 UIColorMakeWithHex(@"#888888")
#define kColorTitle88B UIColorMakeWithHex(@"#88888B")
#define kColorTitle889 UIColorMakeWithHex(@"#889DBB")
#define kColorTitle66B UIColorMakeWithHex(@"#66666B")
#define kColorTitle210 UIColorMakeWithHex(@"#D2D8E2")
#define kColorTitle38 UIColorMakeWithHex(@"#383838")
#define kColorTitleAAC UIColorMakeWithHex(@"#AAAAAC")
#define kColorBorder UIColorMakeWithHex(@"#00DAF2")
#define kColorBtnBG UIColorMakeWithHex(@"#802CB6")
#define kColorRed49 UIColorMakeWithHex(@"#FD5849")
#define kColorShadow(s) UIColorMakeWithRGBA(0, 0, 0, s)
#define kColorWhiteAlpha(s) UIColorMakeWithRGBA(255, 255, 255, s)


/*
 * 通知
 */
#define kNotifyCenter [NSNotificationCenter defaultCenter]
#define kNotifyPost(key) [[NSNotificationCenter defaultCenter] postNotificationName:key object:nil]
#define kNotiPost(key,o) [[NSNotificationCenter defaultCenter] postNotificationName:key object:o]

/*
 * 多语言
 */

#define Localized(key)  [[BRLanguageManager share] stringWithLanguageKey:key]

#pragma mark - 非空
/**
 字符串是否为空
 
 @param str 字符串
 @return YES:空  NO:非空
 */
#define BR_StringIsEmpty(str) ([str isKindOfClass:[NSNull class]] || str == nil || [str length] < 1 ? YES : NO )
#define BR_EmptyStr(s) [BRStringTools br_stringEmpty:s]

/**
 数组是否为空
 
 @param array 数组
 @return YES:空  NO:非空
 */
#define BR_ArrayIsEmpty(array) (array == nil || [array isKindOfClass:[NSNull class]] || array.count == 0)

/**
 字典是否为空
 
 @param dic 字典
 @return YES:空  NO:非空
 */
#define BR_DictIsEmpty(dic) (dic == nil || [dic isKindOfClass:[NSNull class]] || dic.allKeys.count == 0)

/**
 是否是空对象
 
 @param _object 对象
 @return YES:空  NO:非空
 */
#define BR_ObjectIsEmpty(_object) (_object == nil \
|| [_object isKindOfClass:[NSNull class]] \
|| ([_object respondsToSelector:@selector(length)] && [(NSData *)_object length] == 0) \
|| ([_object respondsToSelector:@selector(count)] && [(NSArray *)_object count] == 0))


#endif /* BRConfigs_h */
